package com.wyy.multiredistest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Date: 2023/12/13
 * @Author: wyy
 */
@SpringBootApplication
@RestController
public class MultiRedisTestApplication {

    @Value("${spring.name}")
    private String name;

    @Autowired
    private ApplicationContext applicationContext;


    public static void main(String[] args) {
        SpringApplication.run(MultiRedisTestApplication.class, args);
    }

    @GetMapping("hello")
    public String hello() {
        Map<String, RedisTemplate> redisTemplateMap = applicationContext.getBeansOfType(RedisTemplate.class);
        System.out.println("redisTemplateMap = " + redisTemplateMap);
        System.out.println("name = " + name);
        return name;
    }
}
